package com.topscore.uke.mvp.model;

import com.topscore.uke.entities.MemberMobPosInfo;
import com.topscore.uke.mvp.contractors.GetMemberListContractor;
import com.topscore.uke.mvp.contractors.GetMemberMobPosInfoContractor;
import com.topscore.uke.network.BaseResponse;
import com.topscore.uke.network.retrofit.HandleErrorSubscriber;

import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by 71468 on 2017/11/13.
 */

public class GetMemberMPosModel implements GetMemberMobPosInfoContractor,GetMemberMobPosInfoContractor.Model {
    private CallBack mCallBack;

    public GetMemberMPosModel(CallBack callBack) {
        this.mCallBack = callBack;
    }


    @Override
    public void getInfo(String phone) {
        mService.getMemberMobPosInfo(phone)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .unsubscribeOn(Schedulers.io())
                .subscribe(new HandleErrorSubscriber<BaseResponse<MemberMobPosInfo>>(mCallBack) {
                    @Override
                    public void onSuccess(BaseResponse<MemberMobPosInfo> response) {
                        mCallBack.onGetSuccess(response);
                    }
                });
    }
}
